package prolog.terms

class Trail extends ObjectStack[Var] {

  def name: String = "trail" + hashCode() % 64

  def pprint: String = name + "\n" + super.toString() + "\n"

  def unwind(to: Int) {

    var i = size - to
    while (i > 0) {
      val V = pop()
      V.undo
      i -= 1
    }
  }

  def stat: String = "Trail=" + size

}